-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
copy_file: Add parameter to allow symlinks #252
Conversation
rules/private/copy_file_private.bzl
Outdated
@@ -78,9 +85,10 @@ def _ximpl(ctx): | |||
return _common_impl(ctx, True) | |||
|
|||
_ATTRS = { | |||
"src": attr.label(mandatory = True, allow_single_file = True), | |||
"out": attr.output(mandatory = True), | |||
"is_symlink": attr.bool(mandatory = True), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the is_executable should be folded in here as another bool attribute.
Then you would not need _copy_file vs copy_xfile and the if is_executable
at line 127.
Having two different techniques for doing this differentiation is confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, we also have to set is_executable = True
on the rule to allow it as tool for other actions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but it would be an attribute on copy_file, and you would just pass the value down from the macro to the rule. The virtually duplicated call at lines 131-150 would fold away.
This change adds a new parameter `allow_symlinks` to `copy_file` that allows the action to create a symlink instead of doing an expensive copy if the execution platform (host) allows it. Updates bazelbuild#248
Updated the PR according to the discussion in #248. ptal, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. With the refactoring you were able to add the new feature while only growing the code by 7 lines.
Sorry for the delay, I've been busy doing other things! Updated the PR to address your comments. ptal, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is mostly good. Just the question about executable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Things must have gone out of sync again. Maybe you just need a merge to fix CI.
Updating the branch did fix CI, thanks for the review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll merge on Monday unless I hear objections
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Is there anything left to get this merged? |
Nope. Other than a reminder. It turns out last week was busier than I thought and it slipped my mind. |
This change adds a new parameter
allow_symlinks
tocopy_file
thatallows the action to create a symlink instead of doing an expensive
copy if the execution platform (host) allows it.
Updates #248